<?php
namespace app\common\controller;
use think\Db;

   Class Admin extends Curd {

       protected function _initialize(){
           parent::_initialize();
           if($this->module=='admin'){
               if($this->action=='index'){
                   $res = Db::name('top_nav')->where('module',$this->controller)->find();
                   if($res){
                       if($res['is_delete']||$res['is_hide']){
                           $dom ="";
                           $dom .="<style>body{margin: 0}</style>";
                           $dom .= "<img  style='display:block;width: 100%;height: 100%' src='/dustar/public/static/common/img/404.jpg'>";
                           exit( $dom );
                       }
                   }
               }
           }
           else{
               $url = '/' . $this->module . '/' . $this->controller .'/' . $this->action;
               $res = Db::name('left_nav')->where('url',$url)->find();
               if($res){
                   if($res['is_delete']||$res['is_hide']){
                       $dom ="";
                       $dom .="<style>body{margin: 0}</style>";
                       $dom .= "<img  style='display:block;width: 100%;height: 100%' src='/dustar/public/static/common/img/404.jpg'>";
                       exit( $dom );
                   }
               }
           }
       }

   }